﻿using System;
using UnityEngine;

namespace DefaultNamespace
{
    public class TemplateModel : MonoBehaviour
    {
        private void Start()
        {
            IPeople people = new NorthPeople();
            people.Eat();

            people = new SouthPeople();
            people.Eat();
        }
    }

    public abstract class IPeople
    {
        public void Eat()
        {
            OrderFoods();
            EatSomething();
            PayBill();
        }

        private void OrderFoods()
        {
            Debug.Log("Dian Dan");
        }

        protected virtual void EatSomething()
        {
        }

        private void PayBill()
        {
            Debug.Log("Mai Dan");
        }
    }

    public class NorthPeople : IPeople
    {
        protected override void EatSomething()
        {
            base.EatSomething();
            Debug.Log("Chi Mian Tiao");
        }
    }

    public class SouthPeople : IPeople
    {
        protected override void EatSomething()
        {
            base.EatSomething();
            Debug.Log("Chi Mi Fan");
        }
    }
}